package com.springframework.beanLifecycle;

public class LifecycleBean {
    private int id;

    public LifecycleBean() {
        System.out.println("1 bean对象创建，调用无参构造");
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        System.out.println("2 给bean对象设置属性值");
        this.id = id;
    }

    public void initMethod() {
        System.out.println("4 bean对象初始化，调用指定的初始化的方法");
    }

    public void destroyMethod() {
        System.out.println("7 bean对象销毁，调用指定的销毁的方法");
    }


    @Override
    public String toString() {
        return "LifecycleBean{" +
                "id=" + id +
                '}';
    }
}
